<template>
	<view class="goodwrap">
		<!-- 商品详情 -->
		<!-- 商品信息 -->
		<good-basic :basicdata='gooddata.goodbasic' :isGoods="false" v-on:gofree="gofreeA"></good-basic>

		<view class="mt20 bgF">
			<u-parse :html="content"></u-parse>
		</view>
		<view class="goodfoot bgF">
			<u-button :custom-style="goodBtn" shape="circle" @click="linkAdvertise">立即查看</u-button>
		</view>
	</view>
</template>

<script>
	import goodBasic from '@/components/goods/good-basic.vue'
	import json from '@/json/good.js'
	export default {
		components: {
			goodBasic,
		},
		data() {
			return {
				gooddata: {},
				content: `<img src="https://img.alicdn.com/imgextra/i2/4070981820/O1CN01W2oVrX1PJbRjI4Rtk_!!4070981820.jpg"><img src="https://img.alicdn.com/imgextra/i2/4070981820/O1CN01hBQqbV1PJbRjxqhG4_!!4070981820.jpg"><img src="https://img.alicdn.com/imgextra/i2/4070981820/O1CN01UZdgzi1PJbRg10iKj_!!4070981820.jpg"><img src="https://img.alicdn.com/imgextra/i4/4070981820/O1CN01eOBymK1PJbRiEJ2CD_!!4070981820.jpg"><img src="https://img.alicdn.com/imgextra/i2/4070981820/O1CN01kwearN1PJbRXzW8hG_!!4070981820.jpg"><img src="https://img.alicdn.com/imgextra/i4/4070981820/O1CN01cWMoDb1PJbRiVAO2M_!!4070981820.jpg">`,
				goodBtn: {
					width: "690rpx",
					height: "80rpx",
					color: "#FFFFFF",
					background: "linear-gradient(to right,#F7284A,#F7546F)"
				}
			}
		},
		onLoad(option) {
			let goodsdata = json.data

			if (option.text && option.src) {
				goodsdata.goodbasic.goodName = option.text
				if (option.oldprice || option.newprice) {
					goodsdata.goodbasic.goodPrice = option.newprice
					goodsdata.goodbasic.goodOldPrice = option.oldprice
				} else {
					goodsdata.goodbasic.goodPrice = 416
					goodsdata.goodbasic.goodOldPrice = 900
				}
				goodsdata.goodbasic.goodImgList.map((item, index) => {
					item.url = option.src
				})
				this.gooddata = goodsdata
			} else {

				goodsdata.goodbasic.goodImgList.map((item, index) => {
					item.url =
						'https://img.alicdn.com/imgextra/i1/2222906716/O1CN01FBb6AD1zTyZtBIKhD_!!0-item_pic.jpg_2200x2200Q50s50.jpg_.webp'
				})
				this.gooddata = goodsdata
			}
		},
		methods: {
			// 子组件传过来的事件，领取优惠券
			gofreeA() {
				this.hascoupup = true
				this.$refs.coupup.togglePopup('typecoupup');
			},
			linkAdvertise(){
				
			}
		}
	}
</script>

<style lang="scss">
	.goodwrap {
		width: 100%;
		height: 100%;
		padding-bottom: 100rpx;
	}

	.bgF {
		background: #FFFFFF;
	}

	.goodfoot {
		padding: 16rpx 30rpx;
		position: fixed;
		left: 0;
		bottom: 0;
	}

	page {
		background-color: #F7F7F7;
	}
</style>
